import Vue from 'vue'
import App from './App.vue'
//路由
import router from '@/router'
//全局组件
import TypeNav from '@/components/TypeNav'
import Carsousel from '@/components/Carsousel'
import Pagination from '@/components/Pagination'
//引入表单验证
import '@/plugins/validate'

//按需引入
import { Button,MessageBox} from 'element-ui';
//注册全局组件,参数一，全局组件名字，参数二，组件name
Vue.component(TypeNav.name,TypeNav)
Vue.component(Carsousel.name,Carsousel)
Vue.component(Pagination.name,Pagination)
Vue.component(Button.name, Button);
// Element ui 全局注册
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

//store仓库
import store from '@/store'
import "@/mock/mockServer"
import "swiper/css/swiper.css"
//接口统一全部api暴露（统一引入）
import  * as API from '@/api'
//懒加载
import VueLazyload from 'vue-lazyload'
import atm from '@/assets/1.jpg'

import myplugins from '@/plugins/Myplugins'
//myplugins是自定义指令模块对外暴露的对象
Vue.use(myplugins,{
  name:"abc"//定义自定义指令
} )
Vue.use(VueLazyload,{
  //懒加载默认图片
  loading:atm
})

// Vue.config.productionTip = false
new Vue({
  render: h => h(App),
  //全局事件总线
  beforeCreate(){
    Vue.prototype.$bus = this
    Vue.prototype.$API = API
  },
  //注册路由,组件身上就有$router,$route属性
  router,
  //注册仓库,组件身上就有$store属性
  store,
}).$mount('#app')
